const mongoose = require("mongoose");
const {childType} = require("./data/childType.js")
 
let childTypeSchema = new mongoose.Schema({
    Father_id: { type: "ObjectId", ref: "totalType" },
    //商品子类的name
    childType_name: String,
});
 

// 创建model
// 参数1：model的名称
// 参数2：model的结构
// 参数3：model对应的数据库的集合名，（collections集合）
const  chilTdypeModel = mongoose.model("childType", childTypeSchema, "childType");
 
mongoose.connect(
    "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/chenpengProject3",
    {
        useNewUrlParser:true,
        useUnifiedTopology:true,
        auth: { authSource: "admin" }
      },
    async () => {
        await chilTdypeModel.create(childType);
    }
);
